from flask import Blueprint, request, jsonify
from constants import TOKEN  # 导入 TOKEN

login_bp = Blueprint('login', __name__)

@login_bp.route('/login', methods=['POST'])
def login():
    data = request.get_json()
    username = data.get('username')
    password = data.get('password')
    # 这里可以添加实际的用户验证逻辑
    if username == 'admin' and password == '123456':
        return jsonify({'token': TOKEN}), 200
    else:
        return jsonify({'message': '账户或密码错误'}), 401